package cz.idsv.web.mvc.model.service;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Service;

import cz.idsv.web.mvc.model.dao.RegistrationDao;
import cz.idsv.web.mvc.model.entity.RegistrationEntity;

@Service("RegistrationService")
public class RegistrationServiceImpl implements RegistrationService {

	@Autowired()
	private RegistrationDao registrationDao;

	public Collection<RegistrationEntity> findRegistration() throws DataAccessException {
		return registrationDao.findRegistration();
	}

	public void save(RegistrationEntity registrationEntity) {

		registrationDao.save(registrationEntity);
	}

	@Secured({ "ROLE_ADMIN" })
	public void delete(RegistrationEntity registrationEntity) {
		registrationDao.delete(registrationEntity);
	}

	public RegistrationEntity findRegistrationById(Integer id)
			throws DataAccessException {
		return registrationDao.findRegistrationById(id);
	}

	public Collection<RegistrationEntity> findRegistrationByName(String Name)
			throws DataAccessException {
		return registrationDao.findRegistrationByName(Name);
	}
}
